import axios from 'axios';
import {ALL_SERVICE_API} from '../api';
var qs = require('qs');

export const createPersonalGroup = (params) => {
  return axios.post(ALL_SERVICE_API + '/personal-groups', params);
};

export const updatePersonalGroup = (params) => {
  return axios.put(ALL_SERVICE_API + '/personal-groups', params);
};

export const getAllPersonalGroups = (params) => {
  return axios.get(ALL_SERVICE_API + '/personal-groups', {params: params});
};

export const getPersonalGroup = (id) => {
  return axios.get(ALL_SERVICE_API + '/personal-groups/' + id);
};

export const deletePersonalGroup = (id) => {
  return axios.delete(ALL_SERVICE_API + '/personal-groups/' + id);
};

export const addMebPersonsForPersonalGroup = (id, personalIds) => {
  return axios.post(ALL_SERVICE_API + '/personal-groups/meb-personals', qs.stringify({id: id, personalIds: personalIds}));
};

export const deleteMebPersonalForPersonalGroup = (id, mebPersonalId) => {
  return axios.delete(ALL_SERVICE_API + '/personal-groups/' + id + '/meb-personals/' + mebPersonalId);
};
